package cn.brilliantfuture.commentry.entity;

// Generated 2011-11-3 13:34:34 by Hibernate Tools 3.3.0.GA

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.hibernate.validator.NotNull;

/**
 * CommunityRole generated by hbm2java
 */
@Entity
@Table(name = "community_role", catalog = "cabinet")
public class CommunityRole implements java.io.Serializable {

	private static final long serialVersionUID = 1L;
	private Integer communityRoleId;
	private Role role;
	private Community community;

	public CommunityRole() {
	}

	public CommunityRole(Role role, Community community) {
		this.role = role;
		this.community = community;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "community_role_id", unique = true, nullable = false)
	public Integer getCommunityRoleId() {
		return this.communityRoleId;
	}

	public void setCommunityRoleId(Integer communityRoleId) {
		this.communityRoleId = communityRoleId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "fk_role_id", nullable = false)
	@NotNull
	public Role getRole() {
		return this.role;
	}

	public void setRole(Role role) {
		this.role = role;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "fk_community_id", nullable = false)
	@NotNull
	public Community getCommunity() {
		return this.community;
	}

	public void setCommunity(Community community) {
		this.community = community;
	}

}
